/**
  * Author: Mei
  * Date: 2020-12-13 13:45
  * Description: 
  *
  */
#include "../head.h"

using namespace std;

class A {
public:
    A() : array(new int[3]{1, 2, 3}) {
    }

    ~A() {
        cout << "destory" << endl;
        if (nullptr != array) {
            delete[] array;
        }
    }

    A(A &&a) {
        array = a.array;
        a.array = nullptr;
        std::cout << "Memory Copy Construct" << endl;
    }

public:
    int *array{nullptr};
};

A GetTempObj() { //调用拷贝构造函数 生成临时对象
    A a;
    std::cout << a.array << endl;
    return a;
}

int main() {
    A a1;
    A a2(move(a1));
    std::cout << a1.array << endl;


    return 0;
}